﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.TeamFoundation.WorkItemTracking.Client;
using CDSBDemandControl.Model;

namespace CDSBDemandControlService.Translator
{
    public class InvolvedTranslator
    {
        private InvolvedTranslator() { }

        public static DemandCollection Translate(RevisionCollection revision)
        {
            if (revision == null) return null;

            DemandCollection RevisionCollection = new DemandCollection();

            foreach (Revision rev in revision)
            {
                RevisionModel Rev = new RevisionModel();

                Rev.AssignedTo = rev.Fields["Assigned To"].Value.ToString();
                Rev.State = rev.Fields["State"].Value.ToString();
                Rev.ChangedDate = (DateTime)rev.Fields["Changed Date"].Value;

                RevisionCollection.Add(Rev);
            }

            return RevisionCollection;
        }
    }
}